<% include head.ejs%>

<%
detailData.forEach(function (item) {
    var pics=item.apic.split('&&');
%>
<div class="container" style="margin: 50px auto;">

    <div class="row" style="background:rgba(204,204,99,0.5);">
        <ol class="breadcrumb" style="background:rgba(204,204,99,0);">
            <li><a href="index">主页</a></li>
            <li><a href="forum">YouJia故事</a></li>
            <li class="active">故事详情</li>
        </ol>
        <div class="col-sm-8 col-md-8 col-sm-push-2 col-md-push-2" style="background-color:#fff;margin:50px 0;">
            <%if(pics.length>0){%>
            <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
                <!-- Indicators -->
                <ol class="carousel-indicators">
                    <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
                    <%for(var i=1;i<pics.length;i++){%>
                    <li data-target="#carousel-example-generic" data-slide-to="<%=i%>"></li>
                    <%}%>
                </ol>

                <!-- Wrapper for slides -->
                <div class="carousel-inner" role="listbox">
                    <div class="item active">
                        <img src="<%=pics[0]%>" alt="...">
                    </div>
                    <%for(var i=1;i<pics.length;i++){%>
                        <div class="item">
                                <img src="<%=pics[i]%>" alt="...">
                        </div>
                   <%}%>
                </div>

                <!-- Controls -->
                <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
                    <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
                    <span class="sr-only">Previous</span>
                </a>
                <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
                    <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
                    <span class="sr-only">Next</span>
                </a>
            </div>
            <%}%>
            <h2 style="text-align: center;"><%=item.title%></h2>
            <h4 style="text-align: center;"><%=item.author%></h4>
            <p style="font-size: 20px"><%=item.acontent%></p>
        </div>
    </div>
    <div class="row" style="background:rgba(204,204,99,0.5);">
        <div class="col-sm-8 col-md-8 col-sm-push-2 col-md-push-2" style="background:rgba(99,204,33,0.5);">
            <h2 class="navbar-text" >有何感想？</h2>
        </div>
        <div class="col-sm-8 col-md-8 col-sm-push-2 col-md-push-2" style="background:rgba(99,204,33,0.5);">
            <div class="row">
            <div class="col-sm-6 col-md-6 col-sm-push-3 col-md-push-3">
                <form action="detailComment" method="post">
                <div class="input-group">
                    <input type="hidden" name="cuid" value="<%=item.cuid%>" id="cuid">
                    <input type="text" class="form-control" id="com" name="comments" placeholder="我想说......">
                    <span class="input-group-btn">
                         <button class="btn btn-primary" id="send" type="button">发送</button>
                    </span>
                </div>
                </form>
            </div></div>
            <% for(var i=0;i<commentData.length;i++){
            %>
            <div class="row" style="margin-top: 20px;">
                <div class="col-sm-6 col-md-6 col-sm-push-3 col-md-push-3">
                    <div class="media">
                        <div class="media-left">
                            <a href="#">
                                <img class="media-object" src="./img/forum_img/1.jpg" alt="..." style="width: 64px;height: 64px;border-radius: 50%;">
                            </a>
                        </div>
                        <div class="media-body">
                            <h4 class="media-heading">XXX</h4>
                            <%=commentData[i].comments%>
                        </div>
                    </div>
                </div>
            </div>
            <%} %>

            </div>
        </div>
        <div class="col-sm-8 col-md-8 col-sm-push-2 col-md-push-2" style="background:rgba(99,204,33,0.5);">

         </div>
</div>

<%})%>
<!-- Small modal -->
<div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
    <div class="modal-dialog modal-sm" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="gridSystemModalLabel">温馨提示</h4>
            </div>
            <div class="modal-body">
                评论成功
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" id="comfirm" data-dismiss="modal">确定</button>
            </div>
        </div>

    </div>
</div>
<script type="application/javascript" src="js/comment.js"></script>
<%include footer.ejs%>